
#pragma once

enum ReloadDebugCmd
{
	ReloadDebugCmd_ChordInfo = 0,
	ReloadDebugCmd_DataStorageInfo = 1,

	ReloadDebugCmd_Invalid = -1
};

const std::size_t maxReloadDebugMessageSize = 5000;

namespace reload
{
	class NodeId;
	class IpAddressPort;

	class NodeInfo : public asyframe::PacketElement
	{
	public:
		NodeInfo();
		virtual ~NodeInfo();

		virtual retT readFromBuffer( boost::shared_ptr<asyframe::IoBuffer> _pBuffer);
		virtual retT writeToBuffer( boost::shared_ptr<asyframe::IoBuffer> _pBuffer);

		virtual std::size_t size();

		NodeId nodeId_;
		IpAddressPort ipAddressPort_;
	};

	class ChordInfoDebugPacket : public asyframe::PacketElement
	{
	public:
		ChordInfoDebugPacket();
		virtual ~ChordInfoDebugPacket();

		virtual retT readFromBuffer( boost::shared_ptr<asyframe::IoBuffer> _pBuffer);
		virtual retT writeToBuffer( boost::shared_ptr<asyframe::IoBuffer> _pBuffer);

		virtual std::size_t size();

		NodeInfo selfNodeInfo_;
		asyframe::StructVarArray<asyframe::uint16, NodeInfo> predecessors_;
		asyframe::StructVarArray<asyframe::uint16, NodeInfo> successors_;
		asyframe::StructVarArray< asyframe::uint16, asyframe::StructVarArray<asyframe::uint16, NodeInfo> > fingers_;
	};

	class DataStorageInfoDebugPacket : public asyframe::PacketElement
	{
	public:
		DataStorageInfoDebugPacket();
		virtual ~DataStorageInfoDebugPacket();

		virtual retT readFromBuffer( boost::shared_ptr<asyframe::IoBuffer> _pBuffer);
		virtual retT writeToBuffer( boost::shared_ptr<asyframe::IoBuffer> _pBuffer);

		virtual std::size_t size();

		std::size_t nonReplica_;
		std::size_t replica1_;
		std::size_t replica2_;
		std::size_t unknownReplica_;
	};
}
